<?php

namespace App\Http\Controllers;

use App\Models\User;
use App\Repositories\User\UserFilter;
use App\Repositories\User\UserRepository;
use App\Transformers\UserTransformer;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;

class UserController extends Controller
{
    public function index(UserRepository $userRepository, Request $request)
    {
        $paginator = $userRepository->getPaginator(new UserFilter($request));
        return $this->response->paginator($paginator, new UserTransformer());
    }

    public function show($id)
    {

        return $this->response->item(User::findOrFail($id), new UserTransformer());
    }

    public function store()
    {
        return $this->response()->created('aaa', User::find(1));
    }

    public function update($id)
    {

        return $this->response()->created('222', User::find($id));
    }

    public function destroy($id)
    {
        return $this->response->noContent();

    }
}


